Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@exponent/react-native-action-sheet

Package Overview
Dependencies
Maintainers
4
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@exponent/react-native-action-sheet

A cross-platform ActionSheet for React Native

  • 0.2.3
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
9
decreased by-10%
Maintainers
4
Weekly downloads
 
Created
Source

react-native-action-sheet Slack

ActionSheet is a cross-platform React Native component that uses the native UIActionSheet on iOS and a JS implementation on Android. Almost a drop in replacement for ActionSheetIOS except it cannot be called statically.

Installation

npm install @exponent/react-native-action-sheet

Usage

Wrap your entire app in ActionSheet. We recommend using context to pass ActionSheet to the rest of your app.

import ActionSheet from '@exponent/react-native-action-sheet';
// other imports..

class MainApp extends React.Component {

  static childContextTypes = {
    actionSheet: PropTypes.func,
  };

  getChildContext() {
    return {
      actionSheet: () => this._actionSheetRef,
    };
  }

  render() {
    return (
      <ActionSheet ref={component => this._actionSheetRef = component}>
        // Render the rest of your app here.
      </ActionSheet>
    );
  }
}

To open the action sheet:

import ActionSheet from '@exponent/react-native-action-sheet';
// other imports..

class OtherComponent extends React.Component {

  static contextTypes = {
    actionSheet: PropTypes.func,
  };

  _onOpenActionSheet() {
    // Same interface as https://facebook.github.io/react-native/docs/actionsheetios.html
    let options = ['Delete', 'Save', 'Cancel'];
    let destructiveButtonIndex = 0;
    let cancelButtonIndex = 2;
    this.context.actionSheet().showActionSheetWithOptions({
      options,
      cancelButtonIndex,
      destructiveButtonIndex,
    },
    (buttonIndex) => {
      // Do something here
    });
  }
}

Keywords

FAQs

Package last updated on 08 Sep 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc